package com.wang.controller;

import com.wang.dao.UserMapper;
import com.wang.entity.Users;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Classname UserController
 * @Description TODO
 * @Date 2024/5/22 11:44
 * @Created by pc
 */
@RestController
@Slf4j
@CrossOrigin
public class UserController {

    @Autowired
    private UserMapper userMapper;

    @GetMapping()
    public List<Users> findAll(){
        return userMapper.findAll();
    }

    @RequestMapping("/{id}")
    public Users findById(@PathVariable("id")Integer id){
        return userMapper.findById(id).get();
    }
}
